<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
<#if Session.userName?exists>
	${Session.userName}
	<#else><#if user?exists>${user.name?if_exists}<#else>codebush</#if>
</#if>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Pragma" content="no-cache">
<link href="/codebush/resource/1.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="/codebush/resource/jquery.js"></script>
<script language="JavaScript" src="/codebush/resource/global.js"></script>
<link rel="shortcut icon" href="http://www.douban.com/favicon.ico"	type="image/x-icon">
</head>
<#macro pagination action>
	<#assign rowCount = 20>
	<#assign displayPageNum = 5>
	<p>
	<#if (totalNum?number > rowCount*displayPageNum) && (offset?number>rowCount*(displayPageNum-1))>
	<a href="${action}&offset=0" tilte="the first page">第一页</a>
	</#if>
	<#if (totalNum?number > rowCount)>
		<#if (totalNum?number/rowCount < displayPageNum)>
			<#list 1..(totalNum?number/rowCount+1) as i>
				<#if (offset == (i-1)*rowCount)>
				<a>${i}</a>
				<#else>
				<a href="${action}&offset=${(i-1)*rowCount}">${i}</a>
				</#if>
			</#list>
		<#else>
		<a href="${action}&offset=${(offset?number)/rowCount-rowCount?number*2}">${offset?number/rowCount-2}</a>
		<a href="${action}&offset=${(offset?number)/rowCount-rowCount?number}">${offset?number/rowCount-1}</a>
		<a href="${action}&offset=${(offset?number)/rowCount}">${offset?number/rowCount}</a>
		<a href="${action}&offset=${(offset?number)/rowCount+rowCount?number}">${offset?number/rowCount+1}</a>
		<a href="${action}&offset=${(offset?number)/rowCount+rowCount?number*2}">${offset?number/rowCount+2}</a>
		</#if>
	</#if>
	<#if (offset?number+rowCount < totalNum)>
		<#if totalNum%rowCount == 0>
			<a href="${action}&offset=${totalNum?number-rowCount}">最后一页</a>
		<#else>
			<a href="${action}&offset=${totalNum?number-totalNum%rowCount}">最后一页</a>
		</#if>
	</#if>
</#macro>
